﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Model.Sadharon;
using Model.Poribar;
using Model.Sohaok;
using Model.Poribar.ProductPanjeri;
using Model.Poribar.ColourPanjeri;
using Model.Poribar.SizePanjeri;
using Model.Panjeri;
using Model.Upadan;

namespace InventorySys.controller
{
    public class SizeController
    {
        private ProductSize size;
        private SizeKaz sizeRow;
        public SizeController(){
            sizeRow = Panjeri.getSizePanjeri();
        }

        public Result addNewSize(Object sizeObj) {
            size = (ProductSize)sizeObj;
            return sizeRow.create(size);

        }

        public Result GetAllProductSize() {
            return sizeRow.All();
        }

        public Result UpdateProductSize(string nameValue, string name)
        {
            size = (ProductSize)sizeRow.getByName(name).ResultObj;
            size.Name = nameValue;
            return sizeRow.update(size);
        }

        public Result DeleteProductSize(string name) {
            size = (ProductSize)sizeRow.getByName(name).ResultObj;
            return sizeRow.delete(size.Id);
        }
    }
}
